package com.salton123.soulove.biz_bmob.aty

import android.os.Bundle
import android.text.TextUtils
import android.view.View
import com.alibaba.android.arouter.facade.annotation.Route
import com.salton123.app.BaseApplication
import com.salton123.soulove.app.R
import com.salton123.soulove.common.Constants
import com.salton123.ui.base.BaseActivity
import com.wuhenzhizao.titlebar.widget.CommonTitleBar
import kotlinx.android.synthetic.main.aty_policy.*

/**
 * User: newSalton@outlook.com
 * Date: 2019/8/17 16:40
 * ModifyTime: 16:40
 * Description:
 */
@Route(path = Constants.Router.User.POLICY)
class PolicyActivity : BaseActivity() {
    var url = "https://www.salton123.com/privacy-policy"
    var title = BaseApplication.sInstance.getString(R.string.privacy_policy)
    override fun isAsyncContentView(): Boolean = false
    override fun getLayoutId(): Int = R.layout.aty_policy
    override fun onTitleBarInited(titleBar: CommonTitleBar) {
        super.onTitleBarInited(titleBar)
        titleBar.centerTextView.text = title
        titleBar.centerTextView.visibility = View.VISIBLE
    }

    override fun initViewAndData(savedInstanceState: Bundle?) {
        var targetUrl = intent?.getStringExtra("url") ?: ""
        if (!TextUtils.isEmpty(targetUrl)) {
            url = targetUrl
        }
        var targetTitle = intent?.getStringExtra("title") ?: ""
        if (!TextUtils.isEmpty(targetTitle)) {
            title = targetTitle
        }
        webView.loadUrl(url)
    }
}